<meta name="csrf-token" content="{{ csrf_token() }}">

<style>
    hr{
        height:2px;
    }

    td{
        width:80px;
        margin-left:10px;
        margin-right:10px
    }

    .myBlock{
        margin-left:20px;
    }

</style>
<div class="box" id="myModal1">
    <ul id="date_tab" class="nav nav-tabs">
        <li id="tab-1" class="active" data-toggle="tab"><a  onclick="changeTab(1)">一段班</a></li>
        <li id="tab-2" data-toggle="tab"><a onclick="changeTab(2)">二段班</a></li>
    </ul>
    <div class="box-dialog section-credits section-1" id="section-1" role="document">
        <div class="box-content" style="width:1000px;left:-200px;top:0">
            <div class="box-header">
                <h5 class="box-title" id="exampleModalLabel" style="text-align: center">学分计算规则</h5>
            </div>
            <div class="box-body row">
                <form style="display:inline" class="col-lg-6">
                    <div class="">
                        <div class="" style="font-weight: bold">总计</div>
                        <label class="control-label">满分</label>
                        <input type="text" class="myInput" style="margin-left:10px;width:10%" id="total_score-1">
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold;">考勤</div>
                        <div class="col-lg-6">
                            <table>
                                <tr>
                                    <td>占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_zb-1">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>满分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_total-1"></td>
                                    <td id="kq_total_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>正常</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_zc-1"></td>
                                    <td id="kq_zc_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>迟到</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_cd-1"></td>
                                    <td id="kq_cd_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>缺勤</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_qq-1"></td>
                                    <td id="kq_qq_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>请假</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_qj-1"></td>
                                    <td id="kq_qj_cre-1"></td>
                                </tr>
                            </table></div>
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold">测试</div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>参加占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="cs_zj_zb-1">%</td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>得分占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="cs_mf_zb-1">%</td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold">家校</div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>准交占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_zj_zb-1">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>总分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_total-1"></td>
                                    <td id="jx_total_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>准交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_zj-1"></td>
                                    <td id="jx_zj_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>迟交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_cj-1"></td>
                                    <td id="jx_cj_cre-1"></td>
                                </tr>
                                <tr>
                                    <td>未交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_wj-1"></td>
                                    <td id="jx_wj_cre-1"></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>得分占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_df_zb-1">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>满分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_df_mf-1"></td>
                                    <td id="jx_df_mf_cre-1"></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <hr/>
                </form>
                <div style="display:inline;margin-left:20px" class="col-lg-5">
                    <div style="font-weight:bold">举例</div>
                    <hr/>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>考勤1</td>
                            <td>正常</td>
                            <td></td>
                            <td>10</td>
                        </tr>
                        <tr>
                            <td>考勤2</td>
                            <td>正常</td>
                            <td></td>
                            <td>10</td>
                        </tr>
                        <tr>
                            <td>考勤3</td>
                            <td>迟到</td>
                            <td></td>
                            <td>8</td>
                        </tr>
                        <tr>
                            <td>考勤4</td>
                            <td>缺勤</td>
                            <td></td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>28(40满分)</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：40%/4(单次考勤占比)*（100+100+80+0）=28
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>测试1</td>
                            <td>参加</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>测试2</td>
                            <td>参加</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>测试3</td>
                            <td>参加</td>
                            <td>90</td>
                            <td>5.625</td>
                        </tr>
                        <tr>
                            <td>测试4</td>
                            <td>未参加</td>
                            <td>0</td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>19.125</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：15%/4（单次测试参加占总学分）*（100+100+60+0）+15%/4（单次测试得分占总学分）*（80+80+90+0）=19.125
                            </td>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr>
                            <td style="font-weight: bold">总计：66.25</td>
                        </tr>
                        </tfoot>
                    </table>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>家校1</td>
                            <td>准交</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>家校2</td>
                            <td>准交</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>家校3</td>
                            <td>迟交</td>
                            <td>90</td>
                            <td>5.625</td>
                        </tr>
                        <tr>
                            <td>家校4</td>
                            <td>未交</td>
                            <td>0</td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>19.125</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：15%/4（单次家校准交占总学分）*（100+100+60+0）+15%/4（单次家校得分占总学分）*（80+80+90+0）=19.125
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="box-dialog section-credits section-2" id="section-2" role="document" style="display:none">
        <div class="box-content" style="width:1000px;left:-200px;top:0">
            <div class="box-header">
                <h5 class="box-title" id="exampleModalLabel" style="text-align: center">学分计算规则</h5>
            </div>
            <div class="box-body row">
                <form style="display:inline" class="col-lg-6">
                    <div class="">
                        <div class="" style="font-weight: bold">总计</div>
                        <label class="control-label">满分</label>
                        <input type="text" class="myInput" style="margin-left:10px;width:10%" id="total_score-2">
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold;">考勤</div>
                        <div class="col-lg-6">
                            <table>
                                <tr>
                                    <td>占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_zb-2">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>满分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_total-2"></td>
                                    <td id="kq_total_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>正常</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_zc-2"></td>
                                    <td id="kq_zc_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>迟到</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_cd-2"></td>
                                    <td id="kq_cd_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>缺勤</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_qq-2"></td>
                                    <td id="kq_qq_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>请假</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="kq_qj-2"></td>
                                    <td id="kq_qj_cre-2"></td>
                                </tr>
                            </table></div>
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold">测试</div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>参加占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="cs_zj_zb-2">%</td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>得分占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="cs_mf_zb-2">%</td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <hr/>
                    <div class="myBlock row">
                        <div class="" style="font-weight: bold">家校</div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>准交占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_zj_zb-2">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>总分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_total-2"></td>
                                    <td id="jx_total_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>准交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_zj-2"></td>
                                    <td id="jx_zj_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>迟交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_cj-2"></td>
                                    <td id="jx_cj_cre-2"></td>
                                </tr>
                                <tr>
                                    <td>未交</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_wj-2"></td>
                                    <td id="jx_wj_cre-2"></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-lg-6" style="display:inline">
                            <table>
                                <tr>
                                    <td>得分占比</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_df_zb-2">%</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>折算学分</td>
                                </tr>
                                <tr>
                                    <td>满分</td>
                                    <td><input type="text" class="myInput" style="width:50%" id="jx_df_mf-2"></td>
                                    <td id="jx_df_mf_cre-2"></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <hr/>
                </form>
                <div style="display:inline;margin-left:20px" class="col-lg-5">
                    <div style="font-weight:bold">举例</div>
                    <hr/>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>考勤1</td>
                            <td>正常</td>
                            <td></td>
                            <td>10</td>
                        </tr>
                        <tr>
                            <td>考勤2</td>
                            <td>正常</td>
                            <td></td>
                            <td>10</td>
                        </tr>
                        <tr>
                            <td>考勤3</td>
                            <td>迟到</td>
                            <td></td>
                            <td>8</td>
                        </tr>
                        <tr>
                            <td>考勤4</td>
                            <td>缺勤</td>
                            <td></td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>28(40满分)</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：40%/4(单次考勤占比)*（100+100+80+0）=28
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>测试1</td>
                            <td>参加</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>测试2</td>
                            <td>参加</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>测试3</td>
                            <td>参加</td>
                            <td>90</td>
                            <td>5.625</td>
                        </tr>
                        <tr>
                            <td>测试4</td>
                            <td>未参加</td>
                            <td>0</td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>19.125</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：15%/4（单次测试参加占总学分）*（100+100+60+0）+15%/4（单次测试得分占总学分）*（80+80+90+0）=19.125
                            </td>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr>
                            <td style="font-weight: bold">总计：66.25</td>
                        </tr>
                        </tfoot>
                    </table>
                    <table class="" style="margin-left:30px;margin-top:30px">
                        <thead>
                        <th>项目</th>
                        <th>情况</th>
                        <th>得分</th>
                        <th>学分得分</th>
                        </thead>
                        <tbody>
                        <tr>
                            <td>家校1</td>
                            <td>准交</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>家校2</td>
                            <td>准交</td>
                            <td>80</td>
                            <td>6.75</td>
                        </tr>
                        <tr>
                            <td>家校3</td>
                            <td>迟交</td>
                            <td>90</td>
                            <td>5.625</td>
                        </tr>
                        <tr>
                            <td>家校4</td>
                            <td>未交</td>
                            <td>0</td>
                            <td>0</td>
                        </tr>
                        <tr>
                            <td>总计</td>
                            <td></td>
                            <td></td>
                            <td>19.125</td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                说明：15%/4（单次家校准交占总学分）*（100+100+60+0）+15%/4（单次家校得分占总学分）*（80+80+90+0）=19.125
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="box-footer">
        <button type="button" id="close" class="btn btn-default"  data-dismiss="box">关闭</button>
        <button type="button" id="clear" class="btn btn-warning">清空</button>
        <button type="button" id="submit" class="btn btn-primary">提交</button>
    </div>
</div>

<div id="page-wrapper">
    <script type="text/javascript">
        function changeTab(section){
            $('.section-credits').css('display','none');
            $('#section-'+section).css('display','table');
        }

        $(document).ready(function(){
            $("input.myInput").on('keyup',function(){
                $(this).val($(this).val().replace(/[^\d.]/g,''));
            });

            var input_list1 = $(".section-1 input.myInput");
            var input_list2 = $(".section-2 input.myInput");
            var rule = '{!! $rule !!}';
            rule = rule.replace(/\[|]/g,'');
            rule = JSON.parse(rule);

            for(i=0;i<input_list1.length;i++){
                var name = $(input_list1[i]).attr('id');
                $(input_list1[i]).val(rule.section1[name]);
            }
            for(i=0;i<input_list2.length;i++){
                var name = $(input_list2[i]).attr('id');
                $(input_list2[i]).val(rule.section2[name]);
            }

            //计算考勤分
            $('#kq_total_cre-1').text($('#total_score-1').val()*$('#kq_zb-1').val()/100);
            var kq_total = $('#kq_total_cre-1').text()/$('#kq_total-1').val();

            var fl = $('#kq_zc-1').val()*kq_total;
            $('#kq_zc_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_cd-1').val()*kq_total;
            $('#kq_cd_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_qq-1').val()*kq_total;
            $('#kq_qq_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_qj-1').val()*kq_total;
            $('#kq_qj_cre-1').text(fl.toFixed(2));


            //作业
            /*            $('#zy_total_cre').text($('#total_score').val()*$('#zy_zj_zb').val()/100);
                        $('#zy_df_mf_cre').text($('#total_score').val()*$('#zy_df_zb').val()/100);
                        var zy_total = $('#zy_total_cre').text()/$('#zy_total').val();

                        var fl = $('#zy_zj').val()*zy_total;
                        $('#zy_zj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_cj').val()*zy_total;
                        $('#zy_cj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_wj').val()*zy_total;
                        $('#zy_wj_cre').text(fl.toFixed(2));*/


            //家校
            $('#jx_total_cre-1').text($('#total_score-1').val()*$('#jx_zj_zb-1').val()/100);
            $('#jx_df_mf_cre-1').text($('#total_score-1').val()*$('#jx_df_zb-1').val()/100);
            var jx_total = $('#jx_total_cre-1').text()/$('#jx_total-1').val();

            var fl = $('#jx_zj-1').val()*jx_total;
            $('#jx_zj_cre-1').text(fl.toFixed(2));
            var fl = $('#jx_cj-1').val()*jx_total;
            $('#jx_cj_cre-1').text(fl.toFixed(2));
            var fl = $('#jx_wj-1').val()*jx_total;
            $('#jx_wj_cre-1').text(fl.toFixed(2));



            //计算考勤分
            $('#kq_total_cre-2').text($('#total_score-2').val()*$('#kq_zb-2').val()/100);
            var kq_total = $('#kq_total_cre-2').text()/$('#kq_total-2').val();

            var fl = $('#kq_zc-2').val()*kq_total;
            $('#kq_zc_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_cd-2').val()*kq_total;
            $('#kq_cd_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_qq-2').val()*kq_total;
            $('#kq_qq_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_qj-2').val()*kq_total;
            $('#kq_qj_cre-2').text(fl.toFixed(2));


            //作业
            /*            $('#zy_total_cre').text($('#total_score').val()*$('#zy_zj_zb').val()/100);
                        $('#zy_df_mf_cre').text($('#total_score').val()*$('#zy_df_zb').val()/100);
                        var zy_total = $('#zy_total_cre').text()/$('#zy_total').val();

                        var fl = $('#zy_zj').val()*zy_total;
                        $('#zy_zj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_cj').val()*zy_total;
                        $('#zy_cj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_wj').val()*zy_total;
                        $('#zy_wj_cre').text(fl.toFixed(2));*/


            //家校
            $('#jx_total_cre-2').text($('#total_score-2').val()*$('#jx_zj_zb-2').val()/100);
            $('#jx_df_mf_cre-2').text($('#total_score-2').val()*$('#jx_df_zb-2').val()/100);
            var jx_total = $('#jx_total_cre-2').text()/$('#jx_total-2').val();

            var fl = $('#jx_zj-2').val()*jx_total;
            $('#jx_zj_cre-2').text(fl.toFixed(2));
            var fl = $('#jx_cj-2').val()*jx_total;
            $('#jx_cj_cre-2').text(fl.toFixed(2));
            var fl = $('#jx_wj-2').val()*jx_total;
            $('#jx_wj_cre-2').text(fl.toFixed(2));
        });

        $('#submit').on('click',function(){
            var request={section1:[],section2:[]};
            var input_list1 = $(".section-1 input.myInput");
            var input_list2 = $(".section-2 input.myInput");
            var item1 = {};
            var item2 = {};
            for(i=0;i<input_list1.length;i++){
                var name = $(input_list1[i]).attr('id');
                if(name == 'undefined'){
                    continue;
                }
                if($(input_list1[i]).val() == ''){
                    alert('一段班有规则没有填写，请检查！');
                    return;
                }
                //request[name] = $(input_list[i]).val();
                //request.section1[name] = $(input_list1[i]).val();
                item1[name] = $(input_list1[i]).val();
            }
            request.section1 = item1;

            for(i=0;i<input_list2.length;i++){
                var name = $(input_list2[i]).attr('id');
                if(name == 'undefined'){
                    continue;
                }
                if($(input_list2[i]).val() == ''){
                    alert('二段班有规则没有填写，请检查！');
                    return;
                }
                //request[name] = $(input_list[i]).val();
                item2[name] = $(input_list2[i]).val();
            }
            request.section2 = item2;

            var sum = parseInt($('#kq_zb-1').val()) + parseInt($('#cs_zj_zb-1').val()) + parseInt($('#cs_mf_zb-1').val()) + parseInt($('#jx_zj_zb-1').val()) + parseInt($('#jx_df_zb-1').val());
            if(sum != 100){
                alert('一段班占比之和不等于100%，请检查！');
                return;
            }

            sum = parseInt($('#kq_zb-2').val()) + parseInt($('#cs_zj_zb-2').val()) + parseInt($('#cs_mf_zb-2').val()) + parseInt($('#jx_zj_zb-2').val()) + parseInt($('#jx_df_zb-2').val());
            if(sum != 100){
                alert('二段班占比之和不等于100%，请检查！');
                return;
            }

            $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},async:false});
            $.post('/admin/credits/save',request,function(data){
                alert(data.message);
            });
        });

        $('input.myInput').on('change',function(){
            //计算考勤分
            $('#kq_total_cre-1').text($('#total_score-1').val()*$('#kq_zb-1').val()/100);
            var kq_total = $('#kq_total_cre-1').text()/$('#kq_total-1').val();

            var fl = $('#kq_zc-1').val()*kq_total;
            $('#kq_zc_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_cd-1').val()*kq_total;
            $('#kq_cd_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_qq-1').val()*kq_total;
            $('#kq_qq_cre-1').text(fl.toFixed(2));
            var fl = $('#kq_qj-1').val()*kq_total;
            $('#kq_qj_cre-1').text(fl.toFixed(2));


            //作业
/*            $('#zy_total_cre').text($('#total_score').val()*$('#zy_zj_zb').val()/100);
            $('#zy_df_mf_cre').text($('#total_score').val()*$('#zy_df_zb').val()/100);
            var zy_total = $('#zy_total_cre').text()/$('#zy_total').val();

            var fl = $('#zy_zj').val()*zy_total;
            $('#zy_zj_cre').text(fl.toFixed(2));
            var fl = $('#zy_cj').val()*zy_total;
            $('#zy_cj_cre').text(fl.toFixed(2));
            var fl = $('#zy_wj').val()*zy_total;
            $('#zy_wj_cre').text(fl.toFixed(2));*/


            //家校
            $('#jx_total_cre-1').text($('#total_score-1').val()*$('#jx_zj_zb-1').val()/100);
            $('#jx_df_mf_cre-1').text($('#total_score-1').val()*$('#jx_df_zb-1').val()/100);
            var jx_total = $('#jx_total_cre-1').text()/$('#jx_total-1').val();

            var fl = $('#jx_zj-1').val()*jx_total;
            $('#jx_zj_cre-1').text(fl.toFixed(2));
            var fl = $('#jx_cj-1').val()*jx_total;
            $('#jx_cj_cre-1').text(fl.toFixed(2));
            var fl = $('#jx_wj-1').val()*jx_total;
            $('#jx_wj_cre-1').text(fl.toFixed(2));



            //计算考勤分
            $('#kq_total_cre-2').text($('#total_score-2').val()*$('#kq_zb-2').val()/100);
            var kq_total = $('#kq_total_cre-2').text()/$('#kq_total-2').val();

            var fl = $('#kq_zc-2').val()*kq_total;
            $('#kq_zc_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_cd-2').val()*kq_total;
            $('#kq_cd_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_qq-2').val()*kq_total;
            $('#kq_qq_cre-2').text(fl.toFixed(2));
            var fl = $('#kq_qj-2').val()*kq_total;
            $('#kq_qj_cre-2').text(fl.toFixed(2));


            //作业
            /*            $('#zy_total_cre').text($('#total_score').val()*$('#zy_zj_zb').val()/100);
                        $('#zy_df_mf_cre').text($('#total_score').val()*$('#zy_df_zb').val()/100);
                        var zy_total = $('#zy_total_cre').text()/$('#zy_total').val();
            
                        var fl = $('#zy_zj').val()*zy_total;
                        $('#zy_zj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_cj').val()*zy_total;
                        $('#zy_cj_cre').text(fl.toFixed(2));
                        var fl = $('#zy_wj').val()*zy_total;
                        $('#zy_wj_cre').text(fl.toFixed(2));*/


            //家校
            $('#jx_total_cre-2').text($('#total_score-2').val()*$('#jx_zj_zb-2').val()/100);
            $('#jx_df_mf_cre-2').text($('#total_score-2').val()*$('#jx_df_zb-2').val()/100);
            var jx_total = $('#jx_total_cre-2').text()/$('#jx_total-2').val();

            var fl = $('#jx_zj-2').val()*jx_total;
            $('#jx_zj_cre-2').text(fl.toFixed(2));
            var fl = $('#jx_cj-2').val()*jx_total;
            $('#jx_cj_cre-2').text(fl.toFixed(2));
            var fl = $('#jx_wj-2').val()*jx_total;
            $('#jx_wj_cre-2').text(fl.toFixed(2));
        });
    </script>
</div>